package com.macken.zjh.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.macken.zjh.Zjh;

public abstract class BaseScreen implements Screen {

	public static final int WIDTH = 800;
	public static final int HEIGHT = 480;

	protected Zjh game;

	public BaseScreen(Zjh game) {
		this.game = game;
	}

	@Override
	public void render(float delta) {

	}

	@Override
	public void resize(int width, int height) {

	}

	@Override
	public void show() {

	}

	@Override
	public void hide() {

	}

	@Override
	public void pause() {

	}

	@Override
	public void resume() {

	}

	@Override
	public void dispose() {

	}

	public void setScreenOver(BaseScreen screen) {
		game.setScreen(screen);
	}

	public static TextureRegion load(String name, int width, int height) {
		Texture texture = new Texture(Gdx.files.internal(name));
		TextureRegion region = new TextureRegion(texture, 0, 0, width, height);
		return region;
	}
	public static TextureRegionDrawable getDrawable(TextureAtlas atlas,String name){
		return new TextureRegionDrawable(atlas.findRegion(name));
	}

	public Image getImage(TextureAtlas atlas, String name) {
		return new Image(new TextureRegionDrawable(atlas.findRegion(name)));
	}
}
